home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctjjl86.arc
/
RCINXOR.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-16
|
4KB
|
128 lines
; *** Listing 7 ***
;
;Full row & column inline code XOR graphics driver for putting
; rectangular images into the Color/Graphics Adapter's
; medium-resolution memory map.
;
; Note: AX,BX,CX,DX,BP,SI,DI destroyed.
;
one segment para public 'CODE'
assume cs:one,ds:one,es:nothing
public form_driver
;
form_driver proc near
mov di,[bx+even_line_screen_offset_table] ;find offset of
; top line of image
add di,cx ;ES:DI now points to byte at which to put
; the image's upper left corner
lodsb ;get the height of the image
xor ah,ah ;make height a word value for calculations
mov bx,ax ;store height in BX
lodsb ;get the width of the image in bytes
mov bp,2000h ;calculate the amount to add after even scan
sub bp,ax ; lines are drawn to get to the address of
; the next scan line
mov dx,1fb0h ;calculate amount to subtract after odd scan
add dx,ax ; lines are drawn to get to the address of
; the next scan line
mov cx,[bx+inline_height_vector_table-2] ;-2 because there
; is no 0 lines entry point
mov bx,ax ;number of columns in image
shl bx,1 ;convert into word table index
mov ax,[bx+column_inline_vector_table-2]
xchg ax,cx ;CX now holds column code &,
; AX the row code address
jmp ax ;jmp to into inline code for height
;
;This table is used to find the offset of an even scan line in
; the memory map of the color graphics adapter in medium res mode.
;
even_line_screen_offset_table label word
x=0
rept 100 ;there are 100 even lines
dw x*50h ; each is 50h (80 decimal) long
x=x+1
endm
;
;This is inline code for finding the screen address for each line
; of the image and calling the exclusive-ORing inline code.
;
label macro x ;this macro is used to label the inline code
line&x&: ; entry points
endm
;
;
; inline code for rows
;
x=42 ;there will be an entry point for each even
; number of lines between 2 and 40. They will
; be labeled "line2", "line4", ... "line40"
rept 20 ;each repeat handles 2 lines; 1 even, 1 odd
x=x-2 ;calculate no. of lines for this entry point
label %x ;put in label for entry point
call cx ;CX holds address of inline columns code
add di,bp ;calculate address to start next line of image
call cx ;process image for odd scan line
sub di,dx ;calculate address to start next line of image
endm ; the next line will be an even line
ret
;
;Inline code for XORing a line of the image into the screen
;
clabel macro x ;this macro is used to label the inline code
cline&x&: ; entry points for number of columns to XOR
endm ;
;
x=10 ;this code can handle an image up to ten bytes
rept 10 ; wide
clabel %x ;put in label for entry based on no. of bytes
; in a column
lodsb ;get the next byte from the object's image
xor es:[di],al ; and XOR it with the value now at the
; screen position.
inc di ;point to next image byte in object's form
x=x-1 ;adjust label number
endm
ret ;this return is executed at the end of
; every line
;
;This table is used as an indirect address for jumping into
; the inline code for image moving.
;
inline_height_vector_table label word ;there is no entry point for 0
; lines. Starting at 2
; eliminates the need to store
; a dummy entry point address
entry_address macro x ;this macro is used to generate
dw line&x& ; the labels corresponding to the
endm ; inline code entry points
;
x=2
rept 20
entry_address %x
x=x+2
endm
;
;This table is used as an indirect address for jumping into
; the inline code for exclusive-ORing columns.
;
column_inline_vector_table label word ;there is no entry point for
; 0 lines. Starting at 2
; eliminates a need to store
; a dummy entry point address
column_entry_address macro x ;this macro is used to generate
dw cline&x& ; the labels corresponding to the
endm ; inline code entry points
;
x=1
rept 10
column_entry_address %x
x=x+1
endm
;
;
form_driver endp
one ends
end